package com.app.system
{
	import flash.system.Capabilities;

	public class DeviceInfo
	{
		/**
		 * 设备分辨率，宽
		 * @return 
		 * 
		 */		
		public static function get screenWidth():Number
		{
			//return stage.fullScreenWidth;
			return Capabilities.screenResolutionX;
		}
		
		/**
		 * 设备分辨率，高
		 * @return 
		 * 
		 */		
		public static function get screenHeight():Number
		{
			//return stage.fullScreenHeight;
			return Capabilities.screenResolutionY;
		}
		
		/**
		 * 设备DPI 
		 * @return 
		 * 
		 */		
		public static function get dpi():Number
		{
			//return Capabilities.screenDPI;
			return Number(unescape(Capabilities.serverString).split("&DP=", 2)[1]);
		}
		
		/**
		 * 设备dpWide 
		 * @return 
		 * 
		 */		
		public static function get dpWide():Number
		{
			return screenWidth*160/dpi;
		}
		
		/**
		 * 设备inchesWide 
		 * @return 
		 * 
		 */		
		public static function get inchesWide():Number
		{
			return screenWidth/dpi;
		}
		
		/**
		 * 设备系统平台 
		 * @return 
		 * 
		 */		
		public static function get platform():String
		{
			return Capabilities.os.split(" ")[0];
		}
		
		/**
		 * 设备版本(型号) 
		 * @return 
		 * 
		 */		
		public static function get version():String
		{
			return Capabilities.os.split(" ")[1];
		}
		
		
		/**
		 *  运行版本或 AIR 运行时的制造商
		 * @return 
		 * 
		 */		
		public static function get osName():String
		{
			return  Capabilities.manufacturer;
		}
		
		
		public static function print():void
		{
			trace( "dpi："+dpi+"\r"
					+"dpWide："+dpWide+"\r"
					+"inchesWide："+inchesWide+"\r"
					+"系统平台："+platform+"\r"
					+"系统版本："+version+"\r"
					+"设备分辨率："+screenWidth+"*"+screenHeight);
		}
	}
}